#include "policykithelper.h"
#include <polkit-qt5-1/PolkitQt1/Authority>
PolicyKitHelper::PolicyKitHelper()
{

}

PolicyKitHelper::~PolicyKitHelper()
{

}

bool PolicyKitHelper::checkAuthorization(const QString &actionId, qint64 applicationPid)
{
        Authority::Result result;
        // 第一个参数是需要验证的action，和规则文件写的保持一致
        result = Authority::instance()->checkAuthorizationSync(actionId, UnixProcessSubject(applicationPid),
                                                               Authority::AllowUserInteraction);
        if (result == Authority::Yes) {
            return true;
        }else {
            return false;
        }
}
